#ifndef __SERV_CLIENT_H__
#define __SERV_CLIENT_H__

#include <thrift/transport/TSocket.h>
#include <thrift/protocol/TProtocol.h>
#include "Serv.h"

class CServClient
{
public:
    CServClient();
	CServClient(std::string serverAddr, int serverPort);
	~CServClient();
	void Init(std::string serverAddr, int serverPort);
    bool IsOnline();
    void Connect();
	static CServClient* instance();
public:
    bool thriftMethod(std::string& _return, const std::string &openId, const std::string& method, const std::string& reqArgs);     
    bool thriftMethodSyn(std::string& _return, const std::string &openId, const std::string& method, const std::string& reqArgs);     
private:
	boost::shared_ptr<::apache::thrift::transport::TSocket> m_socket;
	boost::shared_ptr<::apache::thrift::transport::TTransport> m_transport;
	boost::shared_ptr<::apache::thrift::protocol::TProtocol> m_protocol;
	boost::shared_ptr<ServClient> m_servclient;

private:	
	static	CServClient* _instance;

};



#endif

